﻿Public Class Foto : Implements IEquatable(Of Foto)

    Private Const CARPETA_IMAGEN As String = "\cartas\"
    Private Const EXTENSION_IMAGEN As String = ".png"
    'Todas las imágenes en un array -su nombre-
    Private Shared PosiblesFotos() As String = {
                                              "daisy",
                                               "bowser",
                                               "cartabomba",
                                               "cartachampiñon",
                                               "cartamario",
                                               "cartapeach",
                                               "cartaplantapiraña",
                                               "cartashy",
                                               "cartatoad",
                                               "cartayoshi",
                                               "fantasma",
                                               "goomba",
                                               "luigi",
                                               "spiny",
                                               "star",
                                               "wario",
                                               "bala",
                                               "caparazon_rojo",
                                               "caparazon_verde",
                                               "caparazon_azul"
 }

    Public Shared Function SacarRuta(ByVal carta As String) As String
        Return My.Application.Info.DirectoryPath & CARPETA_IMAGEN & carta & EXTENSION_IMAGEN
    End Function
    Public Overrides Function ToString() As String
        Return _Foto
    End Function
    Public Property Foto As String


    Public ReadOnly Property Localizacion As String
        Get
            Return My.Application.Info.DirectoryPath & CARPETA_IMAGEN & _Foto & EXTENSION_IMAGEN
        End Get
    End Property
    Public Sub New()
        Dim aleatorio As New Random
        Dim res = aleatorio.Next(PosiblesFotos.Length)
        _Foto = PosiblesFotos(res)
    End Sub
    Public Sub New(ByVal cual As Integer)
        _Foto = PosiblesFotos(cual)
    End Sub
    Public Sub New(ByVal parametroFoto As String)
        _Foto = parametroFoto
    End Sub

    Public Overloads Function Equals(ByVal other As Foto) As Boolean Implements System.IEquatable(Of Foto).Equals
        Return Equals(other, Me)
    End Function
    Public Overloads Shared Function Equals(ByVal x As Foto, ByVal y As Foto) As Boolean
        Return x._Foto = y._Foto
    End Function
End Class
